Data structure and method for tracking network topology in a fiber channel port driver

ABSTRACT

A network topology data structure resides in a memory system and is representative of topology of a fiber-channel network. The data structure has at least one device record with pointers for linking device records into a device list, information about a device accessible over the network, and pointers for locating a path link list. The data structure also has at least one node record having pointers for linking node records into a node list, node identity information, and pointers for locating device records. Path link lists, accessible through device records, have path links. Path links have pointers for linking path links into the path link list, and path status information corresponding to status of a path through the fiber channel network.

RELATED APPLICATIONS

This application is related to a simultaneously filed applicationentitled “Apparatus and Method for Dynamic Command Queue DepthAdjustment for Storage Area Network Nodes”, identified as Ser. No.09/642,575. This application is also related to a simultaneously filedapplication entitled “Method for Recovery of Paths Between Storage AreaNetwork Nodes with Probationary Period and Desperation Repair”,identified as Ser. No. 09/642,801.

FIELD OF THE INVENTION

The invention relates to the field of computer networking. Inparticular, the invention relates to the field of nodes and switches forFibre Channel storage-area networks. With more particularity, theinvention relates to data structures for use by nodes in dynamicallytracking network resources and configuration so as to properly encodeand route packets over the network.

Nature of the Problem

Most modern computer networks, including switched and arbitrated-loopfibre-channel networks, are packet oriented. In these networks, datatransmitted between machines is divided into chunks of size no greaterthan a predetermined maximum. Each chunk is typically packaged with aheader and a trailer into a packet for transmission. In Fibre-Channelnetworks, packets are known as Frames.

A Fibre-Channel network having at least one switch is a switchedFibre-Channel fabric. A Fibre-Channel switch is a routing devicegenerally capable of receiving frames, storing them, decodingdestination information from headers, and forwarding them to theirdestination or another switch further along a path toward theirdestination. A network interface for connection of a machine to a FibreChannel fabric is known as an N_port, and a machine attached to aFibre-Channel network is known as a node. Nodes may be computers, or maybe storage devices such as RAID systems. An NL_port is an N_port thatsupports additional arbitration required so that it may be connectedeither to a Fibre Channel Fabric or to a Fibre Channel Arbitrated Loop,and an L_port is a network interface for connecting a node to a FibreChannel Arbitrated Loop.

A device including an N_port, L_port, or an NL_port together withhardware for high-speed connection to a machine is a fibre channel hostbus adapter (physical HBA). For example, a physical HBA may comprise aprinted circuit card having one or more NL_ports communicating through aPCI bus interface to an edge connector for connection to a PCI bus of amachine. A physical HBA may, but need not, also incorporate a processorfor controlling its ports and its connection to the machine.

A Fibre Channel Switched Fabric may connect one or more Fibre ChannelArbitrated Loops.

In a switched fibre channel fabric, there may be more than one possiblepath, or sequence of links, loops, switches, routers, etc. that may betraversed by a frame, between two nodes. Multiple paths may beintentional, providing extra capacity or redundancy to protect againstswitch, node, or line failures, or may be unintentional consequences ofnetwork topology.

Multiple paths between two nodes may also be provided through multiplefibre channel arbitrated loops. For example, an initiator node may havetwo NL_ports, one connected to each of two fibre channel arbitratedloops. If each of these loops connects to an NL_port of a target node,then multiple paths from the initiator to the target node exist. Thiscould provide redundancy should a failure occur on one of the arbitratedloops.

Fibre Channel storage-area-network (SAN) nodes and switches, especiallynetwork nodes having multiple ports, must keep track of a variety ofinformation about the network and resources available over the network.This information is used by each node to format and properly routeframes onto and over the network.

Typically, a program references files in storage by passing a commandblock to an operating system. At this level, the command block mayreference files by name and device name, or by handle for files alreadyopened. The operating system passes block I/O requests derived from thecommand block to an appropriate driver. The command block includes acommand field, a file name field, and a drive name or number field inaddition to other fields. The block I/O requests derived from thecommand block typically include fields for device identification,command, and a count of logical blocks to be operated upon, and mayinclude pointers to data.

The device driver typically converts the block I/O requests into asequence of one or more device level commands. Once the driver attemptsto execute each command, it returns to the operating system a responsehaving status information, and other information possibly including dataread from storage. Information from the response may then be transferredto the program.

When a command block references storage accessible over a Fibre Channelnetwork, the driver must encapsulate the device level commands into oneor more command frames, and for write operations one or more dataframes. The driver may use the network information to determine headerinformation and routing for the one or more fibre channel networkframes, or packets, that implement the command.

Typically, the operating system passes block I/O requests to the devicedriver with a device tag identifying the specific device intended toperform the desired operation. This tag may comprise a referenced devicename, handle, or SCSI nexus, where a SCSI nexus includes bus identity,target device number, and logical unit number.

In particular, the driver must translate device tags, into a multileveladdress as required to reach the indicated device. In a Fibre Channelcontext, that multilevel address field must include valid DestinationIdentification (D_ID) fields and routing information field for eachframe. A command frame may specify a specific logical unit. There mayalso be additional destination address fields such as those inassociation headers; association headers permit addressing multipledevices or processes through a single fibre channel port.

The driver, especially a multiport driver servicing multiple ports, musttherefore determine an appropriate destination and routing for eachframe required to implement a command, and transmit those frame over aport appropriate for that routing. It is desirable that thesetranslations and assignments be done quickly and accurately usingnetwork topology information maintained in a local topology database.

The command and data frames transmitted by a node in implementing an I/Ocommand, together with any frames transmitted by another node inresponse to those command and data frames, is known as an exchange.

As nodes, switches, and links are added to or removed from the network,any local topology database must be updated to reflect valid devices onthe network, and valid paths through the network to those devices. Nodesalso may determine one or more paths of the valid paths to a givendevice to be an “active” path. An active path is a path that may be usedfor exchanges.

The Fibre Channel specifications define Class 1 and Class 4 services tobe virtual-circuit, or connection, based services between pairs ofnodes. Packets of a given sequence in these services must arrivein-order with respect to other packets of the same sequence. Thespecifications presume that frames transiting between nodes of each pairfollow a virtual circuit between the nodes—all following the same paththrough the network from node to node and arriving in-order.

Links, loops, and switches of a network may fail. Fibre channel networksmay provide more than one path between a pair of nodes. Multiple,redundant, paths provide redundancy to allow continued communicationsbetween a pair of nodes should one or sometimes more, but not all,links, loops, or switches, and therefore paths through the network,fail.

Some existing fibre-channel systems can recognize failure of a path,switching traffic between a pair of nodes to an alternate path if oneexists. This is known as failover of a path. Unfortunately, switchingClass 1 and Class 4 fibre channel connections, and associated networktraffic, to alternate paths is known to cause considerable delay toongoing exchanges—on the order of seconds. These delays are caused inpart by the need to ensure that Class 1 and Class 4 frames arrive attheir destination in-order; time is allowed for flushing in-transitframes before frames are transmitted on the alternate path.

Further delay may occur if redundant controllers having access to thetarget device must transfer ownership of a logical unit as part of apath failover.

While a link or switch of a fibre channel network may fail, it may alsobe repaired. It is desirable that paths associated with repaired links,loops, or switches be dynamically returned to use to restore networkredundancy and capacity.

Loops, links or switches may develop intermittent problems, where theymay alternate between repaired and failed conditions. Considerable delayof network traffic can be encountered if paths through an intermittentdevice are used, since the delays associated with switching traffic torepaired paths, thence back to alternate paths upon the next failure maybe cumulative. Paths may also be reported as repaired but actually havehigher error rates. High error rates cause delay as frames areretransmitted as errors are detected; high error rates may also cause apath to be considered to have failed. It is therefore desirable tocontrol use of repaired paths such that extended delay does not occur.

It is known that many nodes, including RAID storage subsystems, have theability to queue multiple commands in a command queue for subsequentexecution. For example, a RAID system may queue several read or writecommands, received from one or more machines. Once queued, thesecommands are executed from the queue to or from cache, or to or fromdisk, in an order depending on availability of data in cache, diskavailability and disk rotation. With proper interlocks, execution mayoften be in an order different from that in which the commands werereceived. Commands placed in a command queue of a node by an initiatornode and not yet completed are pending commands. For this purpose,commands that are aborted, including those aborted for timeouts, areconsidered completed.

Commands that may be queued in these devices may include commands frommultiple processes, or threads, running on a single node having one ormore processors. For example, a transaction-processing system may haveseveral processes running, each process requiring access to a differentrecord of a database on a RAID system, all requesting access to thedatabase at about the same time. Each process may create read, write,lock, or unlock commands for the database. Commands may also be queuedfrom multiple nodes, where each node is running one or more processes orthreads that require access to the device. Queuing and execution of eachof these commands requires an exchange of frames between the machine andthe device.

The maximum number, or queue depth, of commands that may be pending inany one device at any one time is finite and characteristic of thedevice. Each node may, but need not, know the queue depth of the devicenodes it is attempting to use, and may throttle its commandsappropriately. Typically, each node originating commands andtransmitting them to the command queue of a device is unaware of thecommands originated by other nodes and assumes it has the full queuedepth of the device available to it.

If a node assumes that the full queue depth of a device is available toit, the queue depth of the device may be exceeded by commands frommultiple nodes. When this happens, the excess commands are refused bythe device and must be retransmitted later; the need for delay andretransmission degrades overall system performance. Conversely, if anode assumes that a device has only a small queue depth available to it,commands may be throttled unduly, such that overall system performanceis impaired. It is desirable to adjust the maximum number of commandsfrom each node transmitted to a device command queue in light of thecommand traffic to that device from other nodes of the network.

Manually tuned allocations of queue depth available to individualinitiator nodes of a storage area network is possible, but is laboriousand error prone. Further, it is known that the load on a system may varyfrom time to time throughout a day; it is desirable to change queuedepth allocations as load changes for optimum performance.

Solution of the Problem

A driver for one or more Fibre Channel N_ports, L_ports, or NL_portsmaintains a local network topology database. This database includeslinked lists of host bus adapter (HBA) port records, target noderecords, and device records.

HBA port records correspond to individual physical N_ports, L_ports orNL_ports and are linked to node records through linked lists of nodelinks. Similarly, node records are linked to device records throughlinked lists of device links, and devices are linked to node linksthrough linked lists of path links. Additional HBA port records may beadded as ports are discovered or as hot-pluggable ports are added to thesystem.

Each node record has information pertinent to a particular port of atarget node of the fibre channel network. A target node may have morethan one port, and may therefore have more than one node record.Similarly, each device record has information pertinent to a particulardevice that can be accessed from one or more nodes. Each path link hasinformation, including status information, pertinent to a particularpath through a fibre channel fabric or arbitrated loop between aphysical HBA port and a physical node or device of the network.

In order to reduce command queue overflow errors, a command queue depthvariable is maintained for each node record. Initially, this is set tomatch a maximum queue depth determined from the type of node representedby the record. This queue depth variable is adjusted downwardly whenqueue overflow errors occur. Queue depth is also adjusted downwardlywhen other initiators are first detected on the fibre channel network,so as to allow those initiators to access the node. The queue depth isadjusted upwardly when a predetermined period elapses without queueoverflow errors.

Nodes that have successfully accessed a target node without queueoverflow errors automatically try successively higher values of queuedepth until they find a depth for optimum performance. Further, queuedepth is automatically reallocated to active nodes as other nodes becomeidle.

In order to limit dispatch of frames over intermittent or problem paths,with attendant errors and retries, freshly repaired and problem linksand their associated paths are given probationary status. Frames arepreferentially dispatched over non-probationary paths if any exist, ifno non-probationary paths exist a probationary path may, in desperation,be returned to normal status. If no probationary paths exist, failedlinks are tested to determine if they have been repaired; a repairedpath may then be activated bypassing the probationary state.

Probationary paths that function without error for a preset period oftime are returned to normal status, where they may once again besubjected to normal use. Probationary paths that record excessive errorcounts are returned to failed status, unless these errors occur within afew seconds of another device logging into a fibre channel fabric; thisprevents marking paths failed solely because of transient errors inducedby nodes bringing their laser diodes online.

The foregoing and other features, utilities and advantages of theinvention will be apparent from the following more particulardescription of a preferred embodiment of the invention as illustrated inthe accompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is an illustration of a Switched Fibre Channel Fabric havingseveral nodes with multiple paths between, and showing drivers andtopology databases;

FIG. 2, a block diagram of a machine that may run a driver and topologydatabase of the present invention and serve as a network node;

FIG. 3, a block diagram illustrating where a local network informationdatabase resides in a system running on a network node;

FIG. 4, an illustration of a data structure for a local networkinformation database as maintained on a node of the present invention;

FIG. 5, an illustration of a fibre channel frame, or packet, header, asis known in the art;

FIG. 6, a diagram of a node record of the topology database;

FIG. 7, a diagram of a device record of the topology database;

FIG. 8, a diagram of a path link of the topology database;

FIG. 9, a diagram of a node link of the topology database;

FIG. 9A, a diagram of an HBA-port record of the topology database;

FIG. 10, a flowchart of dynamic queue depth throttling operationsperformed upon completion of an exchange;

FIG. 11, a flowchart of dynamic queue depth throttling performedperiodically;

FIG. 12, a flowchart of dynamic queue depth throttling operationsperformed when another initiator node logs into the storage areanetwork;

FIG. 13, a flowchart illustrating some steps of probationary repair ofunstable or failed links

FIG. 14, a flowchart illustrating actions taken when a path is detectedrepaired; and

FIG. 15, a flowchart illustrating actions taken when the first frame ofan exchange is transmitted.

DETAILED DESCRIPTION Context in Which the Invention Operates

A Fibre-Channel network (FIG. 1) has a first node 100 that comprises acomputer 102, a software or firmware driver 104 operating in either thecomputer or in a dedicated processor of a fiber channel interface card,and a fibre channel port 106. The network also has a fibre channelfabric 108 comprising one or more switches 110 and 112, a plurality oflinks 114, 116, 118, 120, 122, and 124, and at least one storage node126 and 128. The network may also have one or more additional computernodes, such as node 130.

The driver 104 maintains a network topology database 132. This database132 contains information regarding the topology of the network as isuseful for routing packets and determining destinations for validpackets.

Typically, driver 104 and topology database 132 reside in memory of thecomputer system of a node. For example, portions of the driver 104 andtopology database 132 may reside in main memory devices 200 (FIG. 2),cache 202 and 204, or disk memory 206 of the computer system. The driver104 may execute in a first 208 or an additional 210 processor of thenode. Typically, one or more fibre channel N_ports (node ports) arelocated on a host bus adapter (HBA) 212 attached to the computer system.Portions of the driver 104 and topology database 132 may also reside inlocal memory (not shown) of the HBA 212, for execution by an embeddedprocessor (not shown) of the HBA. There may be an additional HBA 214, oran additional port of the HBA 212. The one or more levels of cachememory 204, main memory 200, local disk 206 of the node, and localmemory of the HBA, together form a memory system of the node, whichstores the driver and the network topology database.

Whenever a process 300 (FIG. 3) executing on the first 208 (FIG. 2) oradditional 210 processor of the node generates an I/O request 302, therequest is processed by the operating system 303 to determine whichdriver should handle the transaction. The request may also be translatedinto block I/O requests 304 for accessing specific blocks of storage,including blocks of directories as well as blocks of data files. Thoseblock I/O requests accessing fibre-channel-accessible devices are passedto the driver 104, which breaks these transactions into packets 305 forthe indicated transaction. Packets 305 are processed by the driver 104to include a valid header, and dispatched to one of one or more ports306 for dispatch into the network fabric 308 or arbitrated loop.

Network Topology Database Structure

HBA Port List

Dispatch of packets to the one of one or more ports is controlled byinformation from the network topology database 132. Within this databaseas detailed in FIG. 4, is maintained an HBA port list 400. Within thislist is a pair of head and tail pointers 402 and an HBA Port Record (404and 406) for each N_Port of an HBA on the system.

Each HBA Port Record (404 and 406) incorporates port status information.The HBA Port Record also incorporates the timers and failure countersnecessary for implementing probationary paths.

Additional HBA port records may be added as ports are discovered or ashot-pluggable ports are added to the system.

Node Links

Each HBA port record, such as HBA port record 404, contains head andtail pointers to a linked list of Node Links 408 and 410. Each Node Link408 contains a pointer to a node record, such as node records 412 and414. The node record contains routing information required for dispatchof packets over the network from an associated hardware HBA port 212 or214 to a specific target port of a target node of the storage areanetwork. Target nodes of the storage area network may be storage nodes,such as storage nodes 126 and 128 (FIG. 1), or may be processor nodessuch as node 130. Each target node has one or more NL_ports, L_ports, orN_ports 136, 138 and 140, through which it attaches to the fabric 108.

Node Records

Each node record 412 and 414 has information relevant to a target nodeof the network. Each node record reachable through pointers in one ormore node links, node record 414 is accessible through node link 410 and416. The node records, including node records 412 and 414, are linkedtogether as a linked target node list 417 accessible through target nodelist head and tail pointers 418.

Device Links

Each node record also contains pointers to a list of device links, suchas device links 420, 422, 424, and 426, associated with that noderecord. As illustrated, node record 412 has pointers to a device linklist containing device links 420 and 422, while node record 414 haspointers to a device link list containing device links 424 and 426. Eachdevice link points to a device record, such as device records 430, 432,and 434.

Device Records

Device records, such as device records 430, 432, and 434, includeinformation relevant to individual devices. Each device may beaccessible through more than one node or port. For example, a RAID diskarray 142 (FIG. 1), that may be accessed through two RAID controllershaving ports 138 and 140, would have a corresponding device recordaccessible through multiple node records and device links.

The device records 430, 432, and 434 are linked together with a set ofhead and tail pointers 436 into a searchable device list 438.

Path Links

Each device record, such as device records 430, 432, and 434, also haspointers to associated lists of path links 440, 442, 444, 446, and 448.Each path link points to a node link, such as node links 408, 410, or416, of the topology database; and corresponds to a physical paththrough the network from an HBA port to the target node and device. Eachpath link also has status information about the corresponding path.

The network topology database of FIG. 4 as drawn does not reflect thespecific structure of the example network of FIG. 1. Each figure is byway of example, showing the types of records and their linkages, ornodes and devices; the topology database is configured automatically torepresent any of a large variety of possible networks.

Detail of Network Topology Database Structure

Node Record Detail

A node record, such a node record 412, is shown in more detail in FIG.6. Referring to FIGS. 6 and 4, included in the record are forward andreverse list pointers 600 for linking the record to the target node listpointers 418 and to other node records such as node record 414. Thereare also device-link list pointers 602 for accessing the list of devicelinks, such as device links 420 and 422. The device-link list pointers602 are therefore pointers through which associated device records maybe located.

Each node record also has node information 604 about the correspondingnode of the network, including node identity information. The nodeidentity information includes the destination ID (D_ID) 606 required forrouting frames to the node, and node identifying information including aglobally unique identifier 608 for the node and port. This identifier isunique among all the nodes of the storage area network. The nodeidentity information may incorporate a node name 610. The globallyunique identifier 608 may comprise the node name 610 and a port nameassociated with the HBA port record through which the node record isreachable since the combination of port name and node name is unique inthe network. The node identity information permits determination ofwhether nodes logging in through a port have already been seen throughanother port. There may also be information for use in higher levels ofprotocol, such as a SCSI address 612 for use withSCSI-over-Fibre-Channel protocols.

The node information also has a number of fields used to manage commandqueues. These include a maximum queue depth 620 for the node, a currentqueue depth 622, a number of pending operations 624, a timer 626, and aqueue depth decrement field 628 for logging the time of the most recentqueue depth reduction due to a queue depth refusal.

Device Record Detail

A device record such as device record 430 has forward and reversepointers 700 (FIG. 7) through which it is linked to the device listpointers 436 and other device records. There are also path link listpointers 702 to any associated list of path links, and deviceinformation 703. Included in the device information 703 is deviceidentification 704, including a device name for user access to thedevice. The device identification 704 may also include unique deviceidentification, such as device serial numbers. The device information703 also includes any logical unit number 706 needed to reference thedevice, device type, status 707, and other device specific information708 of interest to the driver.

Path Link Detail

Each path link, such as path link 440, has list pointers 800 (FIG. 8)for linking it with the associated path link list pointers 702 in theassociated device record and to any other path links associated with thedevice. The path link also has path information 804, including pathstatus 806, and redundancy mode information 814. There is also a pointer816 to an associated node link and a reverse pointer 818 pointing backto the associated device.

Path status 806 includes information indicating which path, of possiblymultiple paths, is an active path on which frames should be sent, andwhich paths are standby paths. It may also include path failure flags.

Node Link Detail

Each node link, such as node link 408, has pointers 900 for linking withpointers of an HBA port record and other node links into a node linklist. Each node link list has at least one link for each and everynetwork node accessible through a particular HBA port. Each node linkalso has an HBA pointer 902 to the associated HBA Port record, and anode pointer 904 to a node record of the target node list. Each nodelink also has route information, including a login delay timer 906 forsuppressing traffic while node login is in progress.

The node link may also have routing information 908 for controllingrouting of frames through the network fabric.

HBA Port Record Detail

Each HBA port record, such as HBA port record 404, has forward andreverse pointers 950 (FIG. 9A) for linking it to other HBA port records,such as HBA port record 406. The HBA port record also has error counters952, probation timers 954, status flags 956, warning counters 958 andfailure counters 960 for implementing the unstable link detection, linkfailure, and probationary repair algorithm herein described. The HBAport record also has node link pointers 962 for pointing to node links.

Network Topology Database Operation

Topology Maintenance

Fibre channel networks are dynamic; nodes may appear or disappear as thenetwork operates, paths may fail or be repaired, and devices may appearor disappear. Host bus adapters may be enabled, added, disabled,removed, or replaced while the system is running, as may individuallinks. Consider the case when a target node logs into the fabric, andappears to an HBA port 406 (FIG. 4). In this event, the target node list417 is searched from head and tail pointers 418 for a node record havingthe same node identity. If a node record, such as record 414, is found,node link 416 is added to the database to indicate that the node can bereached through the relevant port 406 as well as through any other portit is reachable through, such as port 404. If no matching node record isfound, a new node record is created and linked with a new node link. Aninquiry is made of the new node to determine what devices it supports—ifany.

Similarly, when a node reports the devices it supports, the device list438 can be searched for a device record corresponding to each device forthe same device appearing through any other node. If a matching devicerecord is found, new device links are created to link the node record tothe device record and a new path link is created to indicate the newpath through the node; if no matching device is found new device linksare created and linked to a new device record that is linked into thedevice list.

Each node record has forward and reverse list pointers to facilitatedynamic addition and deletion of node structures to the list.

The device and node lists are empty of device structures when the driveris started, device structures are added to the device list as the driverlogs into the network and discovers its topology. Each device recordalso has forward and reverse list pointers to facilitate dynamicaddition and deletion of device structures to the list.

The HBA port list is also empty at driver initialization. The driverdiscovers any physical N, L, or NL ports and adds HBA port records asrequired.

Frame Dispatch with the Topology Database

Fibre channel frames, or packets, are known to have a structure asillustrated in FIG. 5. Each frame has a header 500 that includes adestination identification field (D_ID) 502, a source identificationfield (S_ID) 504, a routing control field (R_CTL) 505, and a frame type506. There are also sequence count (SEQ_CNT) 508, indicating where theframe is in a sequence, originator exchange identity (OX_ID) 510,sequence in transaction identity (Seq_ID) 512 and receiver exchangeidentity (RX_ID) 514 fields for identifying a frame of an exchange. Inmost fibre channel networks, the D_ID field 502, type 506, and routingcontrol fields 505 influence the path followed by the packet from sourceto destination. The S_ID field 504 influences the path followed by anyreply frame.

Consider the case where a process desires access to a specific device byname rather than with a tag. The device may be located by searching fromthe pointers 436 (FIG. 4) of the device list 438 of the network topologydatabase for a device record having the desired device name, such asdevice record 432. A pointer to this record may be returned as a handleor tag to the calling routine to expedite later access. The list of pathlinks 442 and 444 associated with this device record 432 is thensearched for a path link having active status; the associated node link416 may then be located. Alternatively, an active path pointer 710,pointing to a currently active path link, may be stored in the devicerecord. If no path link has active status, a path link having standby orprobationary status may be made active and used instead.

Following the node link pointer 816 of the path link 416, through thenode record pointer 904 of the node link, the associated node record 414is found. From the node record is read the outbound D_ID, and otherrelevant information, for packets intended for the specific device.

From the node link 416, pointer 902 is followed to the associated HBAport record 406 to determine the port on which the packets intended forthe device should be transmitted, and thereby identify the port thatshould appear in the S_ID field of the frame.

Once the D_ID and S_ID fields of the frame are determined, along withany relevant routing control information, the frame is dispatched intothe fabric or onto the arbitrated loop.

Dynamic Control of Command Queue Depth

Target nodes often have a command queue associated with them. Thesenodes may receive and buffer a finite number of queuable commands, whichare then executed. As known in the art, these commands need not beexecuted in order. When an attempt is made to queue more commands thanthe command queue can hold, excess command exchanges are terminated withqueue overflow errors—these commands generally must be re-queued by theinitiator node.

Command queue overflow errors are limited through a dynamically-adjustedcommand queue depth 622 (FIG. 6) and a number of pending operations 624maintained in each node record. The maximum queue depth 620 isinitialized to a maximum queue depth suitable for the type of the targetnode when the node logs into the target node and the node record iscreated; a minimum queue depth (not shown) is also established for eachnode. The current queue depth 622 is set to the maximum of the minimumqueue depth or the maximum queue depth 620 divided by the number ofinitiators visible to the HBA port. The number of initiators 962 seenlogged into the network and visible to the HBA port then maintained inthe HBA port record.

Each time a new I/O operation is requested, the number of pendingoperations 624 is compared to the current queue depth 622 for the targetnode of the operation. If the new operation is of a queueable type andwill cause the current queue depth 622 to be exceeded, the new operationis linked to a delayed operation queue. These operations will beperformed when currently executing operations complete or abort.

If the new operation will not cause the current queue depth 622 to beexceeded, the number of pending operations 624 is incremented, andframes are transmitted as required to initiate the operation.

When I/O operation exchanges terminate 1000 (FIG. 10), frames returnedby the target node are tested 1002 for queue overflow errors. If a queueoverflow error occurs, its time is compared to the last queue decrementtime 628, the prior contents of the last queue decrement time being usedto permit downward adjustment of queue depth at a maximum rate of onceevery five seconds. If downward adjustment of queue depth is done, thelast queue decrement time 628 is updated. The current queue depth 622 ischecked 1004 to determine if it is already at the minimum value. If aqueue overflow error occurs with the queue depth at other than theminimum value, the current queue depth 622 is adjusted downwardly. Thedownward adjustment is either by five 1010, or to the minimum value 1006or 1008, depending on the value of the queue depth and the priorcontents of the last queue refusal variable.

A timer triggers periodic reexamination of current queue depth. Uponexpiration of the timer, the last queue decrement time 628 is checked1100 (FIG. 11) to determine if the current queue depth was decreasedsince the timer last expired. If not, and the current queue depth 622 isless than maximum 1110, the current queue depth 622 is adjusted upwardlyby five 1120 or to maximum 1125, and the timer is restarted.

In an embodiment, the timer expiration interval is also dynamicallyadjusted between a minimum and maximum value during operation. The timerinterval is decreased 1135 when it is greater than minimum and currentqueue depth 622 is adjusted upwardly; the timer interval is increased1140 when it is less than maximum and no adjustment to the queue depth622 has been made since the most recent previous timer expiration. Timerexpiration interval decreases serve to allow for rapid convergence uponoptimal performance, timer expiration interval increases serve to avoidexcess processing time when the queue depth is likely already at themaximum usable queue depth.

In order to provide queue capacity to compute or initiator nodes thathave just logged into the storage area network, a list (not shown) ofknown initiators is maintained in the network topology database 132. Thenode on which the network topology database 132 resides can see somelogins by other initiators to the storage area network.

Each time a login by a new initiator node to the fabric is seen, wherethe new initiator node has access to a target node, the target node list418 of the network topology database 132 is searched 1200 (FIG. 12) tofind any node record, such as node record 412, that is likely to beaddressed by that newly logged-in initiator node.

If a node record is found that may be a target node of the newlylogged-in initiator node, the current queue depth 622 of the node recordis reduced 1202 to the greater of the minimum queue depth for that nodeand the maximum queue depth divided by the number of initiators 962 nowknown to be logged into the associated HBA port.

Since the current queue depth 622 is maintained in the node record,there are one or more separate current queue depth variables for eachtarget node of the network. These variables are adjusted independently;different target nodes may therefore have different current queue depth622 associated with them. Similarly, there are separate numbers (orcounts) of pending operations 624 maintained in the node records, eachcorresponding to different pairings of N_port, L_port, or NL_port to atarget node of the network.

Recovery and Probation of Failed Paths

Each physical path set up through the network from an initiator node toa target node is associated with an HBA port record and a path link, asheretofore described. The path link has a status flag 806 (FIG. 8),which may have the conditions Active, or Normal, among other possiblestatus conditions. The HBA port record has further status informationregarding the path and particularly relevant to status of the physicallink between the physical HBA port corresponding to the HBA port recordand the fabric.

In order to limit dispatch of frames over intermittent or problem linksand paths, with attendant errors and retries, freshly repaired andproblem paths are given probationary status. Frames are preferentiallydispatched over non-probationary paths if any exist, if nonon-probationary paths exist a probationary path may, in desperation, bereturned to active status when they become available for frames.

Each time an error is detected 1300, a routine (FIG. 13) is invoked forlogging that error against the-link and path used for the exchange.Errors are filtered 1302 to exclude errors not potentially related to afailed or unstable link, and evaluated for error severity. Severe errors1304 may cause the link to be marked failed 1306 immediately in the HBAport record and the HBA port's laser diodes taken off-line. Less seriouserrors are counted 1308, with the link marked failed or marked unstableonly if high numbers of these errors are encountered.

Errors on non-probationary links are identified 1310, and binned into10-second intervals. Records are maintained 1312 for four consecutive10-second intervals. Only if errors are found in the current 10-secondinterval and three immediately previous 10-second intervals is a linkconsidered unstable 1314. If the link is not unstable, retransmissionmay be attempted or error reported, and the error routine returns 1316.

If the link is determined unstable 1314, the HBA port record is markedunstable 1318 and a search 1320 is made in the topology database foralternate paths to all destinations reached over that link. Failover isdone for those paths for which alternate paths exist. If any path doesnot have an alternate, the error routine returns 1316 without failingthe link 1306 or taking the laser diodes off-line.

Whenever the laser diodes for a link are taken off-line, a 5-minutedelay 1322 timer is started. When this timer expires, or all other pathsto a node previously reachable over that link fail, a repair detectionattempt 1324 is made on that link. Repair detection requires that thelaser diodes be brought back on line and link testing be performed. Ifthe link test 1326 fails, the laser diodes are taken back offline 1328and the 5-minute delay 1322 restarted.

If the link test passes, the link is marked 1330 probationary in the HBAport record (FIG. 9). The link error and warning counters 952 arecleared and a one minute restartable and cancellable probation timer 956and 1332 (FIG. 13) is started. Login attempts are begun to reestablishpaths from this port to all accessible target nodes reachable over thisport, including those accessible target nodes that were formerlyreachable over this port.

Upon expiration of the one minute probation timer 1332, the logged errorcount 952 on the link is checked 1334 to verify that it is zero. If noerrors have occurred on the link, the link and associated paths aremarked 1336 normal status. If errors occurred without their having beenassociated with logins, as discussed below, the link is treated as stillunstable 1318, and may be marked failed 1306 and the laser diodes onceagain taken offline.

Should errors occur on a probationary path 1310, a five-second loginwindow delay 1340 is started. Should any login by another node beobserved during this five-second delay, the errors are considered to berelated to that login. The error counter 952 is cleared 1342 and theone-minute probation delay 1332 is restarted 1344.

Each time a path is detected repaired (FIG. 14), a firmware or softwaretimer associated with that link is cleared 1400 in the HBA port record.The link is also marked probationary 1402.

When an attempt to transmit an exchange is made (FIG. 15), the activepath pointer 710 (FIG. 7) is followed to see if it points to a validactive path. If that pointer does not point to a currently valid andactive path, or it points to a failed path, a search 1500 is made amongthe path links for an active path. If an active path is found, theassociated frames are transmitted on that path 1502, this may be anactive path over an unstable link if no alternate path exists. If nopath is marked active, a search 1504 is made for one or more pathsmarked normal. If one or more paths marked normal exist, one of thosepaths is selected, marked active 1506, and used to transmit 1508 theframe. If no path marked Normal exists, a search 1510 is made for one ormore paths associated with a link marked probationary. If one or morepaths marked Probationary exist, one of those paths is selected, markedactive 1512, and used to transmit 1514 the frame. Any associatedone-minute probation timer or five-second error login window timer iscancelled. In this way, a Probationary path may be made active in adesperation recovery.

If no active, normal, or probationary path is found, a search is made1516 for a path taken offline as unstable or failed. If none is found,the exchange attempt is rejected 1518 since there is no path on which itcan be sent. If such an offline path is found, a repair detect attempt1520 is made; this requires bringing the laser diodes back online andtesting the associated link. If the link tests good, any required logins1522 are done, the path is marked active 1524 in the path link, anyother paths through the link are marked normal, and the path is used1526 to transmit the frame. In this way, an offline link may be madeactive in a desperation recovery. If the link tests bad, the laserdiodes are taken back offline 1530 and the frame is rejected 1518 sincethere is no path on which it can be sent.

Conclusion

While the invention has been particularly shown and described withreference to one or more embodiments thereof, it will be understood bythose skilled in the art that various other changes in the form anddetails may be made without departing from the spirit and scope of theinvention.

For example, the order of fields within the node record, path link, anddevice record may be readily altered for a particular embodiment of theinvention. Similarly, the reverse pointers of the node record and thedevice record are present for convenience in inserting and removingrecords from the associated lists, while these confer advantages it ispossible to construct a functional system with only forward links. Ifthe number of devices addressed through a single node is limited, devicelinks and the associated device link list pointers of the node recordsmay be replaced by a plurality of device record pointers in the noderecords.

Node records have been described as accessed through node link records,device records through device link records, and paths through path linkrecords. Each link record has pointers for linking into a linked listand pointers to associated node and device records. It is also possibleto use a long fixed-length or a variable-length HBA-port record, noderecord, or device record; the longer or variable length recordcontaining multiple pointers to other node, device, or node records ofthe database. Using long fixed-length or variable length records may,however, limit the number of nodes, devices and paths trackable by thedatabase. Further, excessive delays and memory fragmentation may beencountered as variable-length record sizes are adjusted while addingnodes and devices to the database.

While the above description has focused on dispatch of frames from anode, switches of a switched fabric also have processors and mustmaintain a network topology database. Packets received by a switch maybe routed on preferred or alternate paths by such a switch according toinformation in a network topology database of the present invention.Each such switch may also implement the probationary period of thepresent invention should paths through that switch be repaired. Switchesimplementing probationary periods on repaired paths may also promoteprobationary paths to normal operation in desperation when noalternative, normal status, paths remain available.

A computer program product is a computer readable memory device or mediahaving recorded upon it computer readable instructions.

It should be understood that this description has been made by way ofexample, and that the invention is defined by the scope of the followingclaims.

What is claimed is:
 1. A memory system having at least one level of memory and having stored therein a network topology database representative of topology of a fibre-channel network, the network topology database comprising: at least one device record further comprising at least one pointer field for linking the at least one device record into a device list, at least some device information, and at least one pointer field for locating a path link list; at least one node record further comprising at least one pointer field for linking the at least one node record into a node list, a field containing node identity information, and at least one pointer field for locating the at least one device record; wherein there is at least one path link list accessible through a device record, the path link list comprising at least one path link, each path link further comprising at least one pointer field for linking the at least one path link into the path link list, and path status information.
 2. The memory system having stored therein a network topology database representative of topology of a fibre-channel network of claim 1, wherein the at least some device information of the device record further comprises device identity information.
 3. The memory system having stored therein a network topology database representative of topology of a fibre-channel network of claim 1, wherein the at least one pointer field of the at least one node record for locating the at least one device record points to at least one device link, the at least one device link having at least one pointer to the at least one device record and at least one pointer for linking the at least one device link into a device link list.
 4. The memory system having stored therein a network topology database representative of topology of a fibre-channel network of claim 3, wherein the network topology database further comprises at least one node link having a pointer to the at least one node record; and at least one HBA port record having links to the at least one node link.
 5. The memory system having stored therein a network topology database representative of topology of a fibre-channel network of claim 4, wherein the at least one HBA port record contains information comprising status information corresponding to status of a link of a fibre channel network, and wherein the status information is permitted to have a probationary value.
 6. A method of tracking topology of a storage area network on an initiator node in communication with one or more target nodes comprising the steps of: creating an HBA port record having information corresponding to a physical network port of the node and further comprising pointers through which at least one node record may be reached; creating a node record for each of the one or more target nodes of the network that are in communication with the initiator node, the node record having at least a node identification and pointers through which at least one device record may be reached; and creating at least one device record for a device of the one or more target nodes of the network that are in communication with the initiator node, the device record having information comprising device identification and pointers through which path information may be located.
 7. The method of tracking topology of a storage area network on an initiator node of claim 6 further comprising the step of creating a linked list of device link records, where each device link record comprises a pointer to a device record, and wherein the pointers through which at least one device record may be reached of the node record are pointers to the linked list of device link records.
 8. The method of tracking topology of a storage area network on an initiator node of claim 7 wherein there is a linked list of device link records for each node record.
 9. The method of tracking topology of a storage area network of claim 8, further comprising the step of creating a linked list of path links, where each path link comprises pointers to a node record, and wherein the pointers through which path information may be located of the device record are pointers to the linked list of path links.
 10. The method of tracking topology of a storage area network of claim 9, further comprising the step of creating a linked list of node links, where each node link comprises a pointer to a node record, and wherein pointers through which at least one node record may be reached are pointers to the linked list of node links.
 11. The method of tracking topology of a storage area network of claim 10, wherein the information corresponding to a physical network port of the node of the HBA port record comprises status information, and wherein the method further comprises the steps of determining that a link of the network has been repaired, marking the status information of the HBA port record probationary, timing a probation period, and changing the status information of the HBA port when the probation period expires.
 12. The method of tracking topology of a storage area network of claim 10, further comprising the step of searching a list of device records for a device record having the same device identification as a device newly found on a node of the network, and creating a device link to the device record if a matching device record is found.
 13. The method of tracking topology of a storage area network of claim 12, further comprising the step of searching a list of node records for a node record having the same node identification as a node newly found on a node of the network, and creating a node link to the node record if a matching node record is found.
 14. The method of tracking topology of a storage area network of claim 13, further comprising the step of adding an HBA port record having information corresponding to an additional physical network port of the node and comprising pointers through which at least one node record may be reached. 